#! /bin/sh

name=limine
version=9.3.0
revision=1
tarball_url="https://github.com/limine-bootloader/limine/releases/download/v${version}/limine-${version}.tar.gz"
tarball_blake2b="09db8fde9b1d3a78cbf9a7f5c29c295c658bc521db5f0dcf00497d191b942549eb7d8b4eb747904420f1fa8dad70ef09343d0139ed6f0ee1aba0d1b7c626a904"
imagedeps="mtools nasm"
hostdeps="gcc pkg-config"
deps="core-libs"

prepare() {
    autotools_recursive_regen
}

configure() {
    if [ "$ARCHITECTURE" = "x86_64" ]; then
        X86_FLAGS="--enable-bios \
                   --enable-bios-cd \
                   --enable-bios-pxe \
                   --enable-uefi-ia32 \
        "
    fi

    autotools_configure \
        $X86_FLAGS \
        --enable-uefi-$ARCHITECTURE \
        --enable-uefi-cd \
        TOOLCHAIN_FOR_TARGET=${OS_TRIPLET}
}

build() {
    make -j${parallelism}
}

package() {
    DESTDIR="${dest_dir}" make install

    post_package_strip
}
